package net.yunzhanyi.generic.mapper;

import net.yunzhanyi.generic.domain.model.Poetry;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author bestct
 */
@Mapper
public interface PoetryMapper {

    Poetry selectWithDetailsByPrimaryKey(Long poetryId);

    List<Poetry> selectByAuthorId(@Param("authorId") Long authorId);

    Integer selectCountByAuthorId(@Param("authorId") Long authorId);

    void updateTags(@Param("tags") String tags, @Param("pid") Long pid);

    List<Poetry> selectByKeyword(@Param("keyword") String keyword);

    List<Poetry> selectAllPoetry(@Param("dynasty") Integer dynasty, @Param("tagId") Integer tagId);


    void updateDynastyId(@Param("poetryId") Long poetryId, @Param("dynastyId") Integer dynastyId);

    List<Poetry> selectByAuthorIdLimit(@Param("authorId") Long authorId, @Param("limit") Integer limit);

    String selectTitleById(@Param("resId") Long resId);

    Integer selectCount();

    List<Poetry> selectPoetrySimple(@Param("offset") Integer offset, @Param("size") Integer size);

    Poetry selectRandomPoetry(int offset);
}
